/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modulos.consulta.vista;

import javax.swing.JRadioButton;
import javax.swing.JTextField;
import vista.frmPrincipal;
import modulos.cie10.vista.iFrmCie10A;
import vista.modelo.OperacionesVarias;

/**
 *
 * @author Edulima
 */
public class pnlDiagnostico extends javax.swing.JPanel {

    public static final int PRESUNTIVO=0;
    public static final int DEFINITIVO=1;   
    private int idDiagnostico;
    /**
     * Creates new form pnlDiagnostico
     */
    public pnlDiagnostico() {
        initComponents();
    }
    
    public String getDiagnostico(){
        return txtDiagnostico.getText();
    }
    public void setDiagnostico(String diagnostico){
        txtDiagnostico.setText(diagnostico);
    }
    public JTextField getTxt(){
        return txtDiagnostico;
    }
    public JRadioButton getRbtnPresuntivo(){
        return rbtnPresuntivo;
    }
        public JRadioButton getRbtnDefinitivo(){
        return rbtnDefinitivo;
    }
    public int getSeleccion(){
        if(rbtnDefinitivo.isSelected())
            return pnlDiagnostico.DEFINITIVO;
        else
            return pnlDiagnostico.PRESUNTIVO;
    }
    
    public void setSeleccion(int seleccion){
        switch(seleccion){
            case pnlDiagnostico.DEFINITIVO: rbtnDefinitivo.setSelected(true);
                break;
            case pnlDiagnostico.PRESUNTIVO: rbtnPresuntivo.setSelected(true);
                break;
        }
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btng = new javax.swing.ButtonGroup();
        txtDiagnostico = new javax.swing.JTextField();
        rbtnPresuntivo = new javax.swing.JRadioButton();
        rbtnDefinitivo = new javax.swing.JRadioButton();

        setMinimumSize(new java.awt.Dimension(850, 0));
        setPreferredSize(new java.awt.Dimension(850, 27));
        setRequestFocusEnabled(false);

        txtDiagnostico.setToolTipText("Doble click para seleccionar Dg");
        txtDiagnostico.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtDiagnosticoMouseClicked(evt);
            }
        });

        btng.add(rbtnPresuntivo);
        rbtnPresuntivo.setSelected(true);
        rbtnPresuntivo.setText("Presuntivo");

        btng.add(rbtnDefinitivo);
        rbtnDefinitivo.setText("Definitivo");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(txtDiagnostico, javax.swing.GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbtnPresuntivo)
                .addGap(18, 18, 18)
                .addComponent(rbtnDefinitivo))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(txtDiagnostico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(rbtnPresuntivo)
                .addComponent(rbtnDefinitivo))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void txtDiagnosticoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtDiagnosticoMouseClicked
        if (evt.getClickCount() == 2) {
            iFrmCie10A form = new iFrmCie10A(true,this);
            frmPrincipal.dskpPrincipal.add(form);
            OperacionesVarias.centrar(form);
            form.setVisible(true);
        }
    }//GEN-LAST:event_txtDiagnosticoMouseClicked
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup btng;
    private javax.swing.JRadioButton rbtnDefinitivo;
    private javax.swing.JRadioButton rbtnPresuntivo;
    private javax.swing.JTextField txtDiagnostico;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the idDiagnostico
     */
    public int getIdDiagnostico() {
        return idDiagnostico;
    }

    /**
     * @param idDiagnostico the idDiagnostico to set
     */
    public void setIdDiagnostico(int idDiagnostico) {
        this.idDiagnostico = idDiagnostico;
    }
}
